package com.soft.mainsite.common.domain;

/**
 * 前两位:服务标识
 * 中间两位:模块标识
 * 后两位:异常标识
 */

/**
 * <p>ErrorCode.java此类用于</p>
 * <p>@author:xzj</p>
 * <p>@date:2018年11月12日</p>
 * <p>@remark:</p>
 */
public enum ErrorCode {

    ////////////////////////////////////公用异常编码 //////////////////////////
	// TODO 公用异常编码
    E_100101(100101,"传入参数与接口不匹配"),
    E_100102(100102,"验证码错误"),
    E_100103(100103,"验证码为空"),
    E_100104(100104,"查询结果为空"),
    E_100105(100105,"删除失败"),
    E_100106(100106,"excel导出异常"),
    E_100107(100107,"没有权限，无法系统登陆"),
    E_100108(100108,"手机号码未注册"),
    E_100109(100109,"账号不存在"),   
    E_100110(100110,"账号异常"),


    E_100111(100111,"转发页静态化失败"),
    E_100112(100112,"首页静态化失败"),
    E_100113(100113,"栏目首页静态化失败"),
    E_100114(100114,"内容页静态化失败"),
    E_100115(100115,"公共栏目列表静态化失败"),
    E_100116(100116,"初始化公共栏目列表静态失败"),
    E_100117(100117,"关联页面静态化失败"),
    E_100118(100118,"删除静态化败"),
    E_100119(100119,"没有关联静态化模板"),
    E_100120(100120,"请选择需要生成的栏目！"),
    E_100121(100121,"导航栏目不需要静态化！"),
    E_100122(100122,"未查询到栏目信息！"),
    E_100123(100123,"删除静态化败"),
    E_100124(100124,"关联页面静态化失败"),
    E_100125(100125,"初始化公共栏目列表静态失败"),
    E_100126(100126,"栏目列表页静态化失败"),
    E_100127(100127,"触发页静态化失败"),
    /**
     * 敏感词异常
     */
    E_100201(100201,"请添加数据后保存提交！"),
    E_100202(100202,"语句中包含敏感词信息："),

    /**
     * 预约信息异常
     */
    E_100301(100301,"没有需要导出的信息或重新刷新数据重试！！"),
    E_100302(100302,"导出预约信息失败！！"),

    /**
     * 首页幻灯  友情链接
     */
    E_100401(100401,"请上传图片后提交！！"),
    /**
     * 热装楼盘
     */
    E_200001(200001,"热装楼盘查询参数不能为空！"),
    E_200002(200002,"热装楼盘查询经纬度参数不能为空！"),
    E_200003(200003,"热装楼盘查询地区参数不能为空！"),
    E_200004(200004,"热装楼盘查询关键字参数不能为空！"),
    E_200005(200005,"热装楼盘查询是否静态化参数不能为空！"),
    E_200006(200006,"热装楼盘查询站点编号参数不能为空！"),
    ////////////////////////////////////特殊异常编码/////////////////////////////////////
	// TODO 其他异常
    CUSTOM(999998,"自定义异常"),
    UNKOWN(999999,"未知错误");
    

    private int code;
    private String desc;
        
    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(int code) {
        for (ErrorCode resultCode : ErrorCode.values()) {
            if (code == resultCode.getCode()) {
                return resultCode.getDesc();
            }
        }

        return null;
    }

    private ErrorCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static boolean isSupport(int code) {
        for (ErrorCode resultCode : ErrorCode.values()) {
            if (code == resultCode.getCode()) {
                return true;
            }
        }

        return false;
    }
}
